import path from "path";



/**
 * 上线阶段的环境配置
 */
export const prod = {
  port: 9090,
  host: "http://127.0.0.1",
  // api接口基地址，如果改这个了，请改管理后台的axios基地址配置
  apiurl: "/SayHi/api",
  // 初始化 koa2 插件需要的一些配置
  initPlugins: {
    SessionKey: "4WM7mSy5S5kkxcE1I3", // SessionKey: koa-session 秘钥
    staticPath: path.join(__dirname,'../../dist/resources/static'), // 静态资源目录
    viewsPath: path.join(__dirname,'../../dist/resources/static'), // 页面视图存放路径
  },
  	// 网站浏览器标签卡的基础标题
	title: ' | 亮品时尚',
  //typeorm配置
  typeorm: {
		type: 'mysql',
		host: "localhost",
		charset: "utf8_general_ci",
		port: 3307,
		username: "root",
		password: "1234",
		database: "server",
		logging: "all",
		synchronize: false,
		logger: "advanced-console",
		cache: {
			duration: 30000
		},
		maxQueryExecutionTime: 1000,
		entities: [
			`${path.join(__dirname,'../entity/*{.js,.ts}')}`
		]
	},
	banner: {
		welcome: () => {
			return `
        👏  欢迎来到SayHi 👏

        👉  1：PC官网: ${prod.host}:${prod.port}/
        `
		}
	},
	logConfig: {
		appenders: {
			//系统日志
			access: {
				type: 'dateFile',
				pattern: '_yyyy-MM-dd.log',
				alwaysIncludePattern: true,
				encoding:"utf-8",
				category: "access",
				filename: path.join(__dirname, '../../logs/access')
			},
			// 应用日志
			application: {
				type: 'dateFile',
				pattern: '_yyyy-MM-dd.log',
				alwaysIncludePattern: true,
				encoding:"utf-8",
				category: "application",
				filename: path.join(__dirname, '../../logs/application')
			},
			out: {
				type: 'console'
			}
		},
		categories: {
			default: { appenders: [ 'out' ], level: 'info' },
			access: { appenders: [ 'access' ], level: 'info' },
			application: { appenders: [ 'application' ], level: 'WARN'}
		}
	},
};